package com.example.springboot.demo.mapper;

import com.example.springboot.demo.model.MassageInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MassageMapper {
    /**
     * 查询所有消息
     * @return 所有消息
     */
    @Select("select * from message_info where delete_flag = 0")
    List<MassageInfo> selectAll();

    /**
     * 插入消息
     * @param massageInfo 消息
     * @return 影响行数
     */
    @Insert("insert into message_info (`from`, `to`, message) values (#{from}, #{to}, #{message})")
    Integer insert(MassageInfo massageInfo);
}
